package com.example.service.impl;

import com.example.dao.UserDao;
import com.example.pojo.User;
import com.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public List<User> findAll(User user) {
        List<User> userList = userDao.selectList(null);
        return userList;
    }

    @Override
    public void add(User user) {
        userDao.insert(user);
    }

    @Override
    public User findById(String id) {
        return userDao.selectById(id);
    }

    @Override
    public void update(User user) {
        userDao.updateById(user);
    }

    @Override
    public void del(String id) {
        userDao.deleteById(id);
    }
}
